package com.cxz.demo.service.impl;

import annotation.DataLoaderClass;
import annotation.Param;
import annotation.SoiMethod;
import annotation.SoiService;
import com.cxz.demo.loader.UserDataLoader;
import com.cxz.demo.model.UserInfo;
import com.cxz.demo.service.UserService;
import context.SoiContext;

/**
 * @className: UserServiceImpl
 * @author: ocxz1
 * @date: 2025/3/26 下午5:28
 * @Version: 1.0
 * @description: soi
 */
@SoiService
@DataLoaderClass(UserDataLoader.class)
public class UserServiceImpl implements UserService {

    @SoiMethod(desc = "基本校验用户信息", value = "baseCheckUser")
    public boolean baseCheckUser(@Param(isAutoAssembly = false) UserInfo userInfo, SoiContext soiContext) {
        soiContext.putBusinessData("userId", userInfo.getId());
        return true;
    }

    @SoiMethod(desc = "加载用户信息", value = "loadUserInfo")
    public UserInfo loadUserInfo(@Param("userId") Long userId, SoiContext soiContext) {
        return new UserInfo();
    }

    @SoiMethod(desc = "校验用户信息", value = "checkUser")
    public boolean checkUser(UserInfo userInfo) {
        return true;
    }

    @SoiMethod(desc = "添加用户", value = "addUser")
    public void addUser(UserInfo userInfo) {
        System.out.println("add user");
    }
}
